package com.itheima.mapper;

import com.itheima.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    @Select("select  * from dept")
    List<Dept> findAll();

    /**
     * 根据部门id进行删除
     * @param id
     */
    @Delete("delete from dept where id= #{id}")
    Integer delete(Integer id);

    /**
     * 新增数据
     * @param dept
     */
    @Insert("insert  into  dept(name,create_time,update_time) values(#{name},#{createTime},#{updateTime})")
    Integer insert(Dept dept);

    /**
     * 数据回显
     * @param id
     * @return
     */
    @Select("select * from dept where id = #{id}")
    Dept getById(Integer id);

    /**
     * 修改数据
     * @param dept
     * @return
     */
    @Update("update dept set  name=#{name},update_time=#{updateTime} where id = #{id}")
    Integer update(Dept dept);
}
